<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!--  文件选择标签
        type="file" 选择文件
        accept="image/*" 推荐选择 图片类  /* 通配,所有
        placeholder 提示信息
    -->
    <input type="file" name="avatar" accept="image/*" placeholder="请选择头像" />
    <script>
      // change 内容改变
       const input= document.querySelector('[type="file"]')
       input.onchange=(e)=>{
        // console.log(e);
        console.log(e.target.files[0]);
       }
    </script>
  </body>
</html>
